package com.wulaobo.stream;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @Author wuwenbo
 * @Date 2024/5/24 11:31
 * @ClassName: UnionDemo
 * @Description: TODO
 */
public class UnionDemo {

    public static void main(String[] args) throws Exception {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        env.setParallelism(1);

        DataStreamSource<Integer> ds1 = env.fromElements(1, 2, 3);
        DataStreamSource<Integer> ds2 = env.fromElements(4, 5, 6);
        DataStreamSource<String> ds3 = env.fromElements("7", "8", "9");

//        ds1.union(ds2).union(ds3.map(Integer::parseInt)).print();

        ds2.union(ds1,ds3.map(Integer::parseInt)).print();

        env.execute();
    }

}
